package study.db.postgresql.mapper.examenrolluser;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;

import java.util.List;
import java.util.Objects;

public interface ExamEnrollUserMapper extends BaseMapper<ExamEnrollUserEO> {


    //****** 以下为默认方法 ******
    default int getTotal() {
        QueryWrapper wrapper = Wrappers.query();
        return selectCount(wrapper);
    }

    default List<ExamEnrollUserEO> getEnrollUserLt() {
        QueryWrapper wrapper = Wrappers.query();
        return selectList(wrapper);
    }

    default List<ExamEnrollUserEO> getEnrollUserLt(Long startId, Long endId) {
        QueryWrapper wrapper = Wrappers.query()
                .ge(!Objects.isNull(startId), "id", startId)
                .le(!Objects.isNull(endId), "id", endId)
                .orderByAsc("id");
        return selectList(wrapper);
    }
}
